#ifndef PONGFRENZY_HPP_INCLUDED
#define PONGFRENZY_HPP_INCLUDED

#include <SFML/Graphics.hpp>

#include "../game_state.hpp"
#include "../singleton.hpp"

#include <iostream>
#include "math.h"
#define PI 3.14159265


struct Ponger {

	sf::Sprite racquet;
	int bonus;
	int lives;
	int speed;
};

struct Ball {

	sf::Sprite sprite;
	float speed;
	float direction;
	int owner;
};

class PongFrenzy: public GameState, public Singleton<PongFrenzy> {
	friend class Singleton<PongFrenzy>;
	public:
		void init(Engine *engine);
		void cleanup();

		void pause();
		void resume();

		void processEvent(Engine *engine, PlayerEvent& event);
		void update(Engine *engine);
		void draw(Engine *engine);

	protected:
		PongFrenzy();
		~PongFrenzy();

		sf::Sprite ground, background;

		std::map<int, Ponger> pongers;
		Ball ball;
		sf::Clock clock;

		int gamesLeft;

        bool isCollisionCercle(float,float,float,float,float,float);
        bool isCollisionRect(float,float,float,float,float,float,float,float);

        void addScore(Engine *engine,int,int);
        void gameInit(Engine *engine);
};

#endif // GAME_HPP_INCLUDED
